const fs=require('fs');
let re=fs.readFileSync('node/persons.json','utf8')
console.log(typeof re)
ck=JSON.parse(re)
let user = { username:"xssm12",password:"12223" }


if (ck.find(item=>item.username==user.username)) {
    console.log('已有账号')

} else {
ck.push(user)
  
   console.log('注册成功')
  fs.writeFileSync('node/persons.json',JSON.stringify(ck))

}